﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;

namespace Common
{
    public class ThanhVien
    {
        public int iThanhVien_ID { get; set; }
        public string sTenThanhVien { get; set; }
        public string sDiaChi { get; set; }
        public string sDienThoai { get; set; }
        public string sEmail { get; set; }
        public string sTenDangNhap { get; set; }
        public string sMatKhau { get; set; }
        public bool bQuanTri { get; set; }

        public ThanhVien()
        {

        }
        public ThanhVien(SqlDataReader reader)
        {
            if (reader != null && !reader.IsClosed && reader.Read())
            {
                if (!reader.IsDBNull(0)) this.iThanhVien_ID = Convert.ToInt32(reader["iThanhVien_ID"]);
                if (!reader.IsDBNull(1)) this.sTenThanhVien = reader["sTenThanhVien"].ToString();
                if (!reader.IsDBNull(2)) this.sDiaChi = reader["sDiaChi"].ToString();
                if (!reader.IsDBNull(3)) this.sDienThoai = reader["sDienThoai"].ToString();
                if (!reader.IsDBNull(4)) this.sEmail = reader["sEmail"].ToString();
                if (!reader.IsDBNull(5)) this.sTenDangNhap = reader["sTenDangNhap"].ToString();
                if (!reader.IsDBNull(6)) this.sMatKhau = reader["sMatKhau"].ToString();
                if (!reader.IsDBNull(7)) this.bQuanTri = Convert.ToBoolean(reader["bQuanTri"]);
            }
            reader.Close();
            reader.Dispose();
        }
    }
}
